<!DOCTYPE html>
<head>
 
<meta charset="utf-8">
 
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 
<title>index</title>
<link rel="stylesheet" href="__ROOT__/PUBLIC/css/bootstrap.min.css" />
<link rel="stylesheet"
	href="__ROOT__/PUBLIC/jquery-ui-1.13.1/jquery-ui.css">

<script type="text/javascript"
	src="__ROOT__/PUBLIC/jquery-ui-1.13.1/external/jquery/jquery.js"></script>
<script type="text/javascript"
	src="__ROOT__/PUBLIC/jquery-ui-1.13.1/jquery-ui.js"></script>
</head>
<body>
	<!-- <style>
		table,
		table tr th,
		table tr td {
			border: 1px solid #000000;
		}

		table {
			width: 800px;
			min-height: 80px;
			line-height: 40px;
			text-align: center;
			border-collapse: collapse;
		}
	</style>    -->
	  
	<style>
table, table tr th, table tr td {
	border: 1px solid #000000;
}

table {
	min-height: 30px;
	line-height: 180%;
	text-align: center;
	border-collapse: collapse;
}
</style>
	    

	<div>
		<table border=1 cellspacing="0" cellpadding="0" style="border: solid 1px black; border-collapse: collapse">
			<thead>
				<tr>
					<th colspan="11">xxx客户ddd门店订单表</th>
				</tr>
				<tr>
					<th colspan="3">市内发货人 客户名称</th>
					<th>发货日期:</th>
					<th colspan="2">2022-2-13</th>
					<th>订单编码:</th>
					<th colspan="4">eeerrr-2022-1-3-122354564</th>
				</tr>
				<tr>
					<th colspan="2">订货日期:2022-2-03</th>
					<th>收货人:</th>
					<th>王菲菲</th>
					<th>电话:</th>
					<th colspan="6">11122224444</th>
				</tr>
				<tr>
					<th colspan="2">交货日期:2022-2-04</th>
					<th>地址:</th>
					<th colspan="8">河南省郑州市二七区长江路街道赣江路51号长江一号</th>
				</tr>
				<tr>
					<th>序号</th>
					<th>商品编码</th>
					<th>商品名称</th>
					<th>规格型号</th>
					<th>商品类型</th>
					<th>商品箱规</th>
					<th>发货单位</th>
					<th>验收数量</th>
					<th>件数</th>
					<th>备注</th>
					<th>备用</th>
				</tr>

			</thead>
			<tbody>

				<tr>
					<td>1阿斯顿发</td>
					<td>&nbsp&nbsp阿斯顿发奉公守法帝国时代奉公守法公司电话&nbsp&nbsp</td>
					<td>阿斯顿发</td>
					<td>阿斯顿发</td>
					<td>阿斯顿发</td>
					<td>阿斯顿发</td>
					<td>阿斯顿发</td>
					<td>阿斯顿发</td>
					<td>阿斯顿发</td>
					<td>阿斯顿发</td>
					<td>阿斯顿发</td>

				</tr>
			</tbody>
			<tfoot>

				<tr>
					<th>汇总:</th>
					<th>干货:6</th>
					<th>冻货:7</th>
					<th>鲜货:10</th>
					<th colspan="3"></th>
					<th>验收件数250</th>
					<th>件数300</th>
					<th colspan="2"></th>
				</tr>
				<tr>
					<th>备注</th>
					<th colspan="6">发到:赣江路51号长江一号</th>
					<th>备注</th>
					<th colspan="3">零担司机:王某米</th>
				</tr>
			</tfoot>

		</table>
	</div>

	<div style="page-break-after: always">
		<hr>
	</div>
	       
</body>

 
<script>
$("th").resizable();
$("th > div:last-child").removeClass();
	
	$.post("__CONTROLLER__/tjajaxsc/",
 		    { 		      
 		     	     
 		    },
 		    function(data,status){ 	
 		    	
 		    	var temparr1=data.slice(0,data.search("fenge")).split(',');
		    	var temparr2=data.slice(data.search("fenge")+5,data.length);
		    	//转换为json
		    	var j1=$.parseJSON(temparr1);	
		    	var j2=$.parseJSON(temparr2);
 		    	console.log(temparr1); 	
 		   	    console.log(temparr2);
 		   	    
 		   	    var fenyediv="<div style='page-break-after: always'><hr></div>";
 		   	    
 		   	    var divstart= "<div>";
	    	    var divend= "</div>";
	    	    
 		   	    var tanblestart= "<table border=1 cellspacing='0' cellpadding='0' style='border: solid 1px black; border-collapse: collapse'>";
	    	    var tanbleend= "</table>";
	    		    		  	    	
		    	for(var i=0;i<temparr1.length;i++)
		    	{
		    				    		
		    		//表头
		    		 var biaogearr="";
		    		 biaogearr=biaogearr+divstart+tanblestart;
		    	
		    		 biaogearr=biaogearr+"<thead>"
		    		 + "<tr>"
		    		 + "<th colspan='11'><nobr>&nbsp&nbsp"+j1[i].khmc+j1[i].khmd+"订单表&nbsp&nbsp&nbsp&nbsp</nobr></th>"
		    		 + "</tr>"
		    		 + "<tr>"
		    		 + "<th colspan='3'><nobr>&nbsp&nbsp"+j1[i].pslx+"-"+j1[i].khmc+"&nbsp&nbsp</nobr></th>"
		    		 + "<th><nobr>&nbsp&nbsp发货日期:&nbsp&nbsp</nobr></th>"
		    		 + "<th colspan='2'><nobr>&nbsp&nbsp"+j1[i].pcriq+"&nbsp&nbsp</nobr></th>"
		    		 + "<th><nobr>&nbsp&nbsp订单编码:&nbsp&nbsp</nobr></th>"
		    		 + "<th colspan='4'><nobr>&nbsp&nbsp"+j1[i].etddbm+"&nbsp&nbsp</nobr></th>"		
		    		 + "</tr>"
		    		 + "<tr>"
		    		 + "<th colspan='2'><nobr>&nbsp&nbsp订货日期:"+j1[i].ddriqi+"&nbsp&nbsp</nobr></th>"
		    		 + "<th><nobr>&nbsp&nbsp收货人:&nbsp&nbsp</nobr></th>"
		    		 + "<th><nobr>&nbsp&nbsp"+j1[i].shr+"&nbsp&nbsp</nobr></th>"
		    		 + "<th><nobr>&nbsp&nbsp收货人电话:&nbsp&nbsp</nobr></th>"
		    		 + "<th colspan='6'><nobr>&nbsp&nbsp"+j1[i].shrdh+"&nbsp&nbsp</nobr></th>"		    				    		
		    		 + "</tr>"
		    		 + "<th colspan='2'><nobr>&nbsp&nbsp交货日期:"+j1[i].pcriq+"&nbsp&nbsp</nobr></th>"
		    		 + "<th><nobr>&nbsp&nbsp地址:&nbsp&nbsp</nobr></th>"		    		
		    		 + "<th colspan='8'><nobr>&nbsp&nbsp"+j1[i].mddz+"&nbsp&nbsp</nobr></th>"		    				    		
		    		 + "</tr>"		    	
					 + "</thead>"
					 + "<tbody>"
					 + "<tr>"
					
					 + "<th><nobr>&nbsp&nbsp序号&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp商品编码&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp品名&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp商品条码&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp单品规格&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp箱规&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp货物类型&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp最小件数&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp折合箱数&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp备注&nbsp&nbsp</nobr></th>"	
					 + "<th><nobr>&nbsp&nbsp&nbsp&nbsp</nobr>备用</th>"
					 + "</tr>";
					 var tempjssjs=0;
					 var ysslzj=0;
					 var xhcx=0;
					 for(var a=0;a<j2.length;a++)
					 {								
						 if(j1[i].etddbm==j2[a].etddbm){
						 //合计送货数量	 
						 tempjssjs=tempjssjs+Number(j2[a].shjs);		
						 //计算并合计验收总数
						 var tempjsyssl=Number(j2[a].shjs)/Number(j2[a].xianggui);
						 ysslzj=ysslzj+tempjsyssl;
						 //序号重新计算
						 xhcx=xhcx+1
						 biaogearr= biaogearr
						 + "<tr>"						
						 + "<th><nobr>&nbsp&nbsp"+xhcx+"&nbsp&nbsp</nobr></th>"
						 + "<th><nobr>&nbsp&nbsp"+j2[a].spbm+"&nbsp&nbsp</nobr></th>"
						 + "<th><nobr>&nbsp&nbsp"+j2[a].pinming+"&nbsp&nbsp</nobr></th>"
						 + "<th><nobr>&nbsp&nbsp"+j2[a].sptm+"&nbsp&nbsp</nobr></th>"
						 + "<th><nobr>&nbsp&nbsp"+j2[a].dpgg+"&nbsp&nbsp</nobr></th>"
						 + "<th><nobr>&nbsp&nbsp"+j2[a].xianggui+"&nbsp&nbsp</nobr></th>"
						 + "<th><nobr>&nbsp&nbsp"+j2[a].hwlx+"&nbsp&nbsp</nobr></th>"
						 + "<th><nobr>&nbsp&nbsp"+j2[a].shjs+"&nbsp&nbsp</nobr></th>"
						 + "<th><nobr>&nbsp&nbsp"+tempjsyssl+"&nbsp&nbsp</nobr></th>"
						 + "<th><nobr>&nbsp&nbsp"+j2[a].dpbeizhu+"&nbsp&nbsp</nobr></th>"	
						 + "<th><nobr>&nbsp&nbsp&nbsp&nbsp</nobr></th>"
						 + "</tr>";
						 }											
					 }  
					 biaogearr= biaogearr
					 + "</tbody>"
					 + "<tfoot>"
					 + "<tr>"
					 + "<th><nobr>&nbsp&nbsp&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp&nbsp&nbsp</nobr></th>"	
					 + "<th><nobr>&nbsp&nbsp&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp&nbsp&nbsp</nobr></th>"					
					 + "<th><nobr>&nbsp&nbsp合计&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp"+tempjssjs+"&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp"+ysslzj+"&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp&nbsp&nbsp</nobr></th>"
					 + "<th><nobr>&nbsp&nbsp&nbsp&nbsp</nobr></th>"
					 + "</tr>"
					 + "<tr>"
					 + "<th><nobr>&nbsp&nbsp订单备注:&nbsp&nbsp</nobr></th>"	
					 + "<th colspan='6'><nobr>&nbsp&nbsp"+j1[i].ddbeizhu+"&nbsp&nbsp</nobr></th>"					
					 + "<th><nobr>&nbsp&nbsp三方订单号:&nbsp&nbsp</nobr></th>"
					 + "<th  colspan='3'><nobr>&nbsp&nbsp"+j1[i].sfddh+"&nbsp&nbsp</nobr></th>"				
					 + "</tr>"
					 + "<tr>"
					 + "<th><nobr>&nbsp&nbsp备用&nbsp&nbsp</nobr></th>"	
					 + "<th colspan='10'><nobr>&nbsp&nbsp&nbsp&nbsp</nobr></th>"												
					 + "</tr>"
					 + "</tfoot>";
				     biaogearr= biaogearr+tanbleend+divend+fenyediv;					     
				   
		    		 $('body').append(biaogearr);
		    		 //$('body').find('div').last().remove();
		    		 var iDatejsdt = "<script type='text/javascript'>";												   
						iDatejsdt=iDatejsdt							
				    	+"$('th').resizable();"			    		    
				    	+"$('th > div:last-child').removeClass();" ;
				    	iDatejsdt=iDatejsdt+"<\/script>";
				    	
				    $('body').append(iDatejsdt);
		    	} 
 		    });	 	 	  
	      
		
	
</script>
 
</html>
